package com.sjb.sixteen_journey_backend.controller;


import com.sjb.sixteen_journey_backend.common.R;
import com.sjb.sixteen_journey_backend.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * 信息列表中的评论
 *
 * @author jcz
 * @since 2024-07-23
 */
@RestController
@RequestMapping("/message")
public class MessageController {

    @Autowired
    private IMessageService messageService;

    /**
     * 获取用户所有回复到的评论
     * @return
     */
    @GetMapping("/getMessages")
    public R getMessages() {
        return messageService.getMessages();
    }

    /**
     * 根据id获取回复到的评论
     * @param id
     * @return
     */
    @GetMapping("/getMessageById/{id}")
    public R getMessageById(@PathVariable("id") Integer id){
        return messageService.getMessageById(id);
    }

    /**
     * 删除评论信息
     * @param commentId
     * @return
     */
    @GetMapping("/deleteCommentMessage/{id}")
    public R deleteCommentMessage(@PathVariable("id") Integer commentId){
        return messageService.deleteCommentMessage(commentId);
    }
}
